# -*- coding: utf-8 -*-
import requests
import json
import time

# md5 function
def md5(pwd):
    import hashlib
    m = hashlib.md5()
    m.update(pwd)
    return m.hexdigest()


url = 'http://123.56.124.18:8080/AliMNS/sms/publish'
secretkey = "908167EF3CE4BAEF"
timestamp = str(time.time())
token = md5(timestamp + secretkey)

headers = {
    'Content-Type': 'application/json;charset=utf-8',
    'timestamp': timestamp,
    'token':token
        }
mydata={
    "signName": "智客",
    "templateCode": "SMS_57710150",
    "templateParams": {
        "code":"123456",
        "product":"智客"
                    },
    "phone": ['15928039345']
    }
r = requests.post(url, data=json.dumps(mydata),headers=headers)
print r.content
print r.text
print r.status_code
